<!--短信验证码登录页面-->
<template>
	<div class="login">
		<!--登录logo-->
		<div class="login-center">
			<div class="login-logo"><img src="../../assets/images/logo.png"></div>
			<!--登录信息输入-->
			<div class="login-input">
				<div class="login-input-pass"><input type="text" placeholder="请输入验证码" />
					<span v-show="show" @click="getCode" class="login-input-span">获取验证码</span>
					<span v-show="!show" class="login-input-count">重新发送({{count}})</span>
				</div>
				<div class="login-input-bt">
					<router-link to="/login">确认</router-link>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		name: 'Login',
		data() {
			return {
				show: true,
				count: '',
				timer: null,
			}
		},
		methods: {
			getCode() {
				const TIME_COUNT = 60;
				if(!this.timer) {
					this.count = TIME_COUNT;
					this.show = false;
					this.timer = setInterval(() => {
						if(this.count > 0 && this.count <= TIME_COUNT) {
							this.count--;
						} else {
							this.show = true;
							clearInterval(this.timer);
							this.timer = null;
						}
					}, 1000)
				}
			}
		}
	}
</script>
<style scoped>
	/*登录logo*/
	
	.login {
		position: absolute;
		height: 100%;
		width: 100%;
		background: #FFFFFF;
	}
	
	.login-center {
		width: 640px;
		margin: 0 auto;
	}
	
	.login-logo {
		display: flex;
		align-items: center;
		justify-content: center;
		padding-top: 80px;
	}
	
	.login-logo>img {
		width: 250px;
	}
	/*登录信息输入*/
	
	.login-input {
		padding: 1.55rem 0.95rem;
	}
	
	.login-input-pass {
		display: flex;
		border-bottom: 1px #F4F4F4 solid;
		align-items: center
	}
	
	.login-input-pass>input {
		width: 100%;
		border: none;
		height: 45px;
		line-height: 45px;
		outline: none;
	}
	
	.login-input-span {
		font-size: 14px;
		color: #37B3FF;
		width: 100px;
		border-left: 1px #DCDCDC solid;
		padding-left: 15px;
		margin-left: 15px
	}
	
	.login-input-count {
		font-size: 14px;
		color: #bbbbbb;
		width: 100px;
		border-left: 1px #DCDCDC solid;
		padding-left: 15px;
		margin-left: 15px
	}
	
	.login-input-bt {
		margin-top: 15px;
		text-align: center;
		width: 100%;
		height: 45px;
		line-height: 45px;
		color: #FFFFFF;
		background: #37B3FF;
		border-radius: 15px;
		font-size: 14px;
	}
	
	.login-input-bt>a {
		color: #FFFFFF;
		display: block
	}
</style>